package com.jie.eduservice.controller;

import com.jie.commonutils.ResultEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 用户登录类
 * @author XieZhiJie
 * @create 2020-10-06 14:51
 */
//@CrossOrigin  // 解决跨域问题
@RequestMapping("/eduservice/user")
@RestController
public class EduLoginController {

    // login
    @PostMapping("/login")
    public ResultEntity login() {
        // 暂时先做模拟
        return ResultEntity.ok().data("token", "admin");  // 感觉像是返回用户的令牌(通行证之类), 大概要等到与spring security做整合才知道了
    }

    // info
    @GetMapping("/info")
    public ResultEntity info() {
        // 暂时先做模拟
        return ResultEntity.ok()
                .data("roles", "[admin]")
                .data("name", "admin")
                .data("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");  // 头像
    }

}
